package chatserver.main;


import chatserver.objects.Server;
import chatserver.gui.MainWindow;
import chatserver.logging.ServerLog;




public class ServerMain {

    private static MainWindow mw;
    
    
    public static void main(String argv[]) throws Exception {

        Server server = Server.getInstance();
        server.start();

        boolean noGui = false;
        for(String arg : argv)
        {
            arg = arg.toLowerCase();
            if(arg.contains("nogui"))
            {
                noGui = true;
            }
        }
        
        if(!noGui)
        {
          mw = new MainWindow("ChatServer v1.0");
        }
        
        ServerLog.log("ChatServer v1.0 started");
    }
    
    public static void addLog(String log)
    {
        if(mw == null)
        {
            return;
        }
        mw.addLog(log);
    }
    
}
